package com.pan.admin.module.loanUser.contorller;

import com.pan.admin.common.annotation.Log;
import com.pan.admin.common.core.controller.BaseController;
import com.pan.admin.common.core.domain.AjaxResult;
import com.pan.admin.common.core.page.TableDataInfo;
import com.pan.admin.common.enums.BusinessType;
import com.pan.admin.common.utils.poi.ExcelUtil;
import com.pan.admin.module.loanUser.entity.LoanUserMarketLog;
import com.pan.admin.module.loanUser.service.LoanUserMarketLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 用户贷款超市轨迹日志Controller
 *
 * @author ts
 * @date 2023-10-08
 */
@RestController
@RequestMapping("/loanUser/userMarketLog")
public class LoanUserMarketLogController extends BaseController {
    @Autowired
    private LoanUserMarketLogService loanUserMarketLogService;

    /**
     * 查询用户贷款超市轨迹日志列表
     */
    @PreAuthorize("@ss.hasPermi('loanUser:userMarketLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(LoanUserMarketLog loanUserMarketLog) {
        List<LoanUserMarketLog> list = loanUserMarketLogService.list(loanUserMarketLog);
        return getDataTable(list);
    }

    /**
     * 导出用户贷款超市轨迹日志列表
     */
    @PreAuthorize("@ss.hasPermi('loanUser:userMarketLog:export')")
    @Log(title = "用户贷款超市轨迹日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LoanUserMarketLog loanUserMarketLog) {
        List<LoanUserMarketLog> list = loanUserMarketLogService.list(loanUserMarketLog);
        ExcelUtil<LoanUserMarketLog> util = new ExcelUtil<LoanUserMarketLog>(LoanUserMarketLog.class);
        util.exportExcel(response, list, "用户贷款超市轨迹日志数据");
    }

    /**
     * 获取用户贷款超市轨迹日志详细贷超列表信息
     */
    @PreAuthorize("@ss.hasPermi('loanUser:userMarketLog:details')")
    @GetMapping(value = "/details")
    public TableDataInfo details(LoanUserMarketLog loanUserMarketLog) {
        startPage();
        List<LoanUserMarketLog> list = loanUserMarketLogService.marketListById(loanUserMarketLog);
        return getDataTable(list);
    }

    /**
     * 获取用户贷款超市轨迹日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('loanUser:userMarketLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(loanUserMarketLogService.getById(id));
    }


}
